package main

// #cgo CFLAGS: -I.
// #cgo LDFLAGS: -L. -lminiserv
// #include "miniserv.h"
import "C"

import (
	"log"
	"net/http"
	"io"
)


func readTelemetry(response http.ResponseWriter, request *http.Request){
	resp := C.GoString(C.readTelemetry())
	response.WriteHeader(200)
	io.WriteString(response, resp)
}

func main() {
	http.HandleFunc("/readTelemetry", readTelemetry)
	err := http.ListenAndServe(":80", nil) 
	if nil != err {
		log.Fatal(err) 
	}
}

